#include "stdafx.h"
#include "MessageJukeBox.h"


namespace PM3D
{

    MessageJukeBox::MessageJukeBox(Dispositif* d3dDevice, float timeShown)
        : Police(d3dDevice, L"",  18,1024), timeleft_(-1.0f),
        timeShown_(timeShown), message_(L"")
    {
    }

    MessageJukeBox::~MessageJukeBox(void)
    {
    }

    void MessageJukeBox::draw()
    {
        RECT rect =  {300,225, 980, 325};
        if(timeleft_>0.0f)
            Write(message_, &rect, 
            DT_EXPANDTABS|DT_CENTER, D3DCOLOR_ARGB(255,255,250,0));
    }

    void MessageJukeBox::animate(float dt)
    {   
        timeleft_-=dt;
    }

    void MessageJukeBox::setNewMessage(const std::wstring& message)
    {
        timeleft_= timeShown_;
        message_ = message;
    }

} // fin namespace
